package com.sxl.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * 
 * @TableName modules
 */
@TableName(value ="modules")
@Data
public class Modules implements Serializable {
    /**
     * 模块编号
     */
    @TableId(value = "Id", type = IdType.AUTO)
    private Integer id;

    /**
     * 模块名称
     */
    @TableField(value = "Name")
    private String name;

    /**
     * 父模块编号
     */
    @TableField(value = "ParentId")
    private Integer parentId;

    /**
     * 模块路径
     */
    @TableField(value = "Path")
    private String path;

    /**
     * 权重
     */
    @TableField(value = "Weight")
    private Integer weight;

    /**
     * 预留字符串字段
     */
    @TableField(value = "Ops")
    private String ops;
    @TableField(value = "icon")
    private String icon;
    /**
     * 预留整数字段
     */
    @TableField(value = "type")
    private String type;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private List<Modules> children;//当前菜单的所有子菜单


    @TableField(value = "Name")
    private String title;

    @TableField(exist = false)
    private boolean checked=false;//菜单树的是否勾选

    public void setChecked(boolean checked) {
        if (this.children.size()>0){
            this.checked = false;
        }else {
            this.checked = checked;
        }

    }

    @TableField(exist = false)
    private  boolean spread=false;//菜单树的是否展开

}